package com.huang.auth.converter;

import com.huang.auth.entity.po.AuthRolePO;
import com.huang.auth.entity.vo.AuthRoleInfoVO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author HuangShen
 * @Date 2022/1/24 17:41
 * @Describe authRolePO 转RoleInfo
 */
@Component
public class AuthRoleInfoVOConverter {

    public AuthRoleInfoVO doConvert(AuthRolePO authRolePO  , List<String> menuIds ,List<String> resourceIds) {
        AuthRoleInfoVO authRoleInfoVO = new AuthRoleInfoVO();
        authRoleInfoVO.setId(authRolePO.getId().toString());
        authRoleInfoVO.setName(authRolePO.getName());
        authRoleInfoVO.setCode(authRolePO.getCode());
        authRoleInfoVO.setDescribe_(authRolePO.getDescribe());
        authRoleInfoVO.setStatus(authRolePO.getStatus());
        authRoleInfoVO.setCreateUserId(authRolePO.getCreateUser().toString());
        authRoleInfoVO.setMenus(menuIds);
        authRoleInfoVO.setResources(resourceIds);

        return authRoleInfoVO;
    }
}
